Skip to content

fix: add 30s timeouts to all HTTP clients#72

Merged
Kingvic300 merged 1 commit into
mainfrom
fix/36-http-timeouts
Jun 7, 2026
Merged

fix: add 30s timeouts to all HTTP clients#72
Kingvic300 merged 1 commit into
mainfrom
fix/36-http-timeouts

Conversation

@Kingvic300

@Kingvic300 Kingvic300 commented Jun 7, 2026

Copy link
Copy Markdown
Owner

Summary

Every reqwest client was created with Client::new(), which has no request timeout. A slow or unresponsive upstream (RPC node, Brevo, Groq, Google) would hold a Tokio task/connection open forever — server-side resource exhaustion, and the CLI just appears to freeze with no error.

Changes

Build each client with a 30s timeout, falling back to the default client if the builder ever fails:

Testing

  • cargo check --workspace passes.

Closes #36

Summary by CodeRabbit

Bug Fixes

  • Added 30-second request timeout limits to HTTP clients across all platform components: authentication handlers, backend services (AI processing and email delivery), and blockchain network adapters supporting Aptos, Ethereum, Solana, Soroban, and Sui networks. This prevents indefinite request hangs and improves system reliability and responsiveness.

Every reqwest client was built with Client::new(), which has no request
timeout, so a slow/unresponsive RPC node, Brevo, Groq, or Google endpoint
would hold a task/connection open indefinitely (server resource exhaustion;
the CLI appears to freeze). Build clients with a 30s timeout, falling back
to the default client if the builder ever fails.

Covers backend services (sui, ai, email), the Google OAuth client, the CLI
login client, and all five chain adapters (sui, ethereum, solana, aptos,
soroban).

Closes #36
@vercel

vercel Bot commented Jun 7, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
txio Ready Ready Preview, Comment Jun 7, 2026 11:57am

@coderabbitai

coderabbitai Bot commented Jun 7, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

This pull request adds a uniform 30-second request timeout to all reqwest::Client instances across the backend and CLI. Each client is now constructed via Client::builder().timeout(Duration::from_secs(30)).build() with a fallback to Client::new() if the builder fails, preventing indefinite stalls on unresponsive upstream services.

Changes

HTTP Client Request Timeouts

Layer / File(s) Summary
Add 30-second timeout to all reqwest HTTP clients
backend/api/src/api/handlers/auth_handler.rs, backend/api/src/services/ai_service.rs, backend/api/src/services/email_service.rs, backend/api/src/services/sui_service.rs, cli/src/chains/aptos.rs, cli/src/chains/ethereum.rs, cli/src/chains/solana.rs, cli/src/chains/soroban.rs, cli/src/chains/sui.rs, cli/src/cli/handlers.rs
All 10 client instantiations are refactored from Client::new() to a builder pattern with an explicit 30-second timeout; each includes a fallback to Client::new() on builder error. No public APIs or logic flow changes.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

A rabbit hops through every chain,
Thirty seconds, no more pain—
No hanging threads, no frozen requests,
Your timeouts pass the hardest tests! 🐰⏱️

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: adding 30-second timeouts to all HTTP clients across the codebase.
Linked Issues check ✅ Passed The PR implements the core requirement from issue #36 by adding 30-second timeouts to all reqwest clients, but uses a simpler fallback approach rather than the recommended connect_timeout pairing.
Out of Scope Changes check ✅ Passed All changes are in-scope, consistently applying the same 30-second timeout pattern across 9 files in backend services and CLI chain adapters.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/36-http-timeouts

Comment @coderabbitai help to get the list of available commands and usage tips.

@Kingvic300 Kingvic300 merged commit f5045cb into main Jun 7, 2026
3 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Medium] reqwest HTTP clients have no timeouts (hung upstream blocks workers)

1 participant